﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;

namespace QuickLifeHall.Entity.EasyUI
{
    public class TreeNode
    {
        public string id { get; set; }
        public string text { get; set; }
        /// <summary>
        /// icon图标样式 
        /// </summary>
        public string iconCls { get; set; }
        /// <summary>
        /// JSON 输出为checked，方便在ui中使用
        /// </summary>
        [JsonProperty("checked")]
        public bool isChecked { get; set; }
        /// <summary>
        /// open 或 closed
        /// </summary>
        public string state { get; set; }
        /// <summary>
        /// 自定义的属性
        /// </summary>
        public Dictionary<string, object> attributes { get; set; }
        /// <summary>
        /// 子节点
        /// </summary>
        public List<TreeNode> children { get; set; }

        public TreeNode()
        {
            this.attributes = new Dictionary<string, object>();
        }

        public TreeNode(string id, string text)
            : this()
        {
            this.id = id;
            this.text = text;
        }
    }
}
